package com.ideaaedi.zoo.example.springboot.dynamic.ds.shardingsphere.mapper;

import com.ideaaedi.zoo.example.springboot.dynamic.ds.shardingsphere.po.StudentPO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 学生 mapper
 *
 * @author <font size = "20" color = "#3CAA3C"><a href="https://gitee.com/JustryDeng">JustryDeng</a></font> <img
 * src="https://gitee.com/JustryDeng/shared-files/raw/master/JustryDeng/avatar.jpg" />
 * @since 1.0.0
 */
@Mapper
public interface MysqlStudentMapper {
    
    /**
     * 插入
     */
    @Insert("insert into student (id, name) values (#{student.id}, #{student.name})")
    int insert(@Param("student") StudentPO student);
    
    /**
     * 查询所有
     */
    @Select("select id,`name` from student")
    List<StudentPO> list();
    
    /**
     * 删除全部
     */
    @Insert("delete from student")
    int deleteAll();
}
